<?php

	/*	
		START---------------------------------------------------------------------------------
	
		Name	: clsUtilities.php
		Version	: 1.0
		Author	: Henrik Andersen
		Company : Linnaeus University, Media Technology
		Mail	: Henrik.Andersen@lnu.se
		Date	: 2010-11-22 11:35 CET
		
		DESCRIPTION----------------------------------------------------------------------------
		
		This is a class that contains general functions that can be used everywhere in the 
		system. This class is currently more or less superfluous, but let's keep it for a while.
	
		SYNTAX---------------------------------------------------------------------------------
		
		The following list contains the public functions that can be used externally.
		
		Method Name:								Short Description:
		
		* isValidURL("http://www.google.com")		Check if string is valid URL.
		* toIntLoc(14.03453455)						Convert GPS decimal to int.
		
		TO DO'S--------------------------------------------------------------------------------
		
		END------------------------------------------------------------------------------------
	*/
			
	// PUBLIC CLASS
	
	class clsUtilities
	{						
		// CONSTRUCTOR FUNCTION
		
		/*------------------------------------------------------------------------------------
		__construct:									
		This is the constructor function and it does nothing.
		------------------------------------------------------------------------------------*/
		public function __construct()
		{
			// NOTHING YET..
		}
		
		// PUBLIC FUNCTION
		
		/*------------------------------------------------------------------------------------
		isValidURL:									
		Use to check if a string is a valid URL.
		
		@return		Boolean		If the input string is a valid URL or not.
		------------------------------------------------------------------------------------*/
		public function isValidURL($strURL)
		{
			return preg_match('|^http(s)?://[a-z0-9-]+(.[a-z0-9-]+)*(:[0-9]+)?(/.*)?$|i', $strURL);
		}
		
		/*------------------------------------------------------------------------------------
		toIntLoc:									
		Converting GPS coordinates (decimal) to integer.
		
		@return		int		Location int.
		------------------------------------------------------------------------------------*/
		public function toIntLoc($decLocation)
		{
			return $decLocation * 1000000;
		}
	}

?>